package cn.anc.aonicardv.bean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yangdai on 2017/5/19.
 */

public class AlbumBean extends ResponseResultBean {

    private String date;

    private int position;

    private List<VideoBean> videoBeanList;

    private List<PhotoBean> photoBeanList;

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public List<VideoBean> getVideoBeanList() {
        return videoBeanList;
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }


    public void setVideoBeanList(List<VideoBean> videoBeanList) {
        this.videoBeanList = videoBeanList;
    }

    public List<PhotoBean> getPhotoBeanList() {
        return photoBeanList;
    }

    public void setPhotoBeanList(List<PhotoBean> photoBeanList) {
        this.photoBeanList = photoBeanList;
    }

    public static List<AlbumBean> getClassifyAlbumBeanByPhotoBean(List<PhotoBean> photoBeanList) {
        List<AlbumBean> temp = new ArrayList<>();
        if (photoBeanList == null)
            return temp;
        boolean isAddAlbum = true;
        int c = 0;
        for (int i = 0; i < photoBeanList.size(); i++) {
            if (i != 0) {
                isAddAlbum = false;
            }

            if (isAddAlbum) {
                List<PhotoBean> temp1 = new ArrayList<>();
                temp1.add(photoBeanList.get(i));
                AlbumBean a = new AlbumBean();
                a.setDate(photoBeanList.get(i).getDate());
                a.setPhotoBeanList(temp1);
                a.setPosition(i);
                temp.add(a);
            } else {
                temp.get(c).getPhotoBeanList().add(photoBeanList.get(i));
            }
        }
        return temp;
    }

    public static List<AlbumBean> getClassifyAlbumBeanByVideoBean(List<VideoBean> videoBeanList) {
        List<AlbumBean> temp = new ArrayList<>();
        boolean isAddAlbum = true;
        int c = 0;
        if (videoBeanList == null)
            return temp;
        for (int i = 0; i < videoBeanList.size(); i++) {
            if (i != 0) {
                isAddAlbum = false;
            }
            if (isAddAlbum) {
                List<VideoBean> temp1 = new ArrayList<>();
                temp1.add(videoBeanList.get(i));
                AlbumBean a = new AlbumBean();
                a.setDate(videoBeanList.get(i).getDate());
                a.setVideoBeanList(temp1);
                a.setPosition(i);
                temp.add(a);
            } else {
                temp.get(c).getVideoBeanList().add(videoBeanList.get(i));

            }
        }
        return temp;
    }

    @Override
    public String toString() {
        return "AlbumBean{" +
                "date='" + date + '\'' +
                ", position=" + position +
                ", videoBeanList=" + videoBeanList +
                ", photoBeanList=" + photoBeanList +
                '}';
    }
}
